home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / D-G / DinkClass Shareware Package / DinkClass / DEventHandler.h < prev    next >
Encoding:
Text File  |  1992-12-31  |  3.8 KB  |  121 lines  |  [TEXT/KAHL]

  1. /*
  2.     File:        DEventHandler.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Written by:    Mark Gross
  7.  
  8.     Copyright:    © 1992 by Applied Technical Software, all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <3>    12/31/92    MTG        making the code conditionaly compiled so         that I am
  13.                                     always working with a current         version in either think c
  14.                                     or MPW C++
  15.          <2>    11/14/92    MTG        Bringing the C++ version up to date WRT the         ThinkC
  16.                                     version.
  17.  
  18.     To Do:
  19. */
  20.  
  21.  
  22. // This is the class declaration file for the 
  23. // DEventHandler class  responceble for the implemenation of the 
  24. // menu and event responce modle developed on the train.
  25.  
  26. // The passing on of events to the nextHandler is determend
  27. // by the state of a global variable gPassItOn if false it won't
  28. // otherwise it will pass the event on to the next DEventHandler
  29. // object.  This global is set true inside the event loop of the 
  30. // application.  It is up to the subclasses to change its value it 
  31. // requiered.  It may happen that theEvent may become a global for the
  32. // sake of speed.
  33. // 
  34. #ifndef __DEVENTHANDLER__
  35. #define __DEVENTHANDLER__
  36.  
  37. #include "DObject.h"
  38.  
  39. class DApplication; // forward declaration of application
  40.  
  41.  
  42. class DEventHandler : public DObject
  43. {
  44. public:
  45.  
  46.     static DApplication *gApplication;
  47.         // this is needed to support the cueing up of deletions of
  48.         // event handlers from the list of event Handlers kept by the 
  49.         // application
  50.                                        
  51.     static Boolean gPassItOn;
  52.         // gPassItOn is initialized to true in the event loop.
  53.         // The flag by which the event is passed on or not.    
  54.     
  55.     DEventHandler *fNextHandler;
  56.         // Defines the linked list of DEventHandlers
  57.         
  58.     Boolean fAlive;
  59.         // Needed to Avoid the problem associated with the 
  60.         // clean up process which kills all the fAlive
  61.         // DEventHandlers where some dieing handlers tell
  62.         // depended handlers to die too BUT those dependents STILL get
  63.         // a KillMeNext message because they are still in the
  64.         // list of "Alive" Handlers. This normaly dosen't cause
  65.         // problems except for Document and DWindow objects where
  66.         // it causes trouble in multiple file savings and
  67.         // disposes (like what happens when quitting with lots of open
  68.         // windows) of window related items(crash!).
  69.     
  70.     DEventHandler(void);
  71.         // Instal itself into the event handler list of the
  72.         // application
  73.         
  74.     ~DEventHandler(void);    // empty destructor
  75.  
  76.     
  77.     virtual Boolean KillMeNext(void);
  78.         // frees up all memory and notifies the gApplication that
  79.         // its ready to go and should use the delete opperator on
  80.         // it as soon as its conviniant.  It also has the gApplication
  81.         // object reset linked list, by searching the list of eventHandlers
  82.         // for the ones with THIS as its nextHandler and fixes that guys 
  83.         // nextHandler.
  84.                 
  85. //
  86. // The following are the default event handling methods
  87. //        
  88.     virtual void HandleNullEvent(EventRecord *theEvent);
  89.     virtual void HandleActivateEvt(EventRecord *theEvent);
  90.  
  91.     virtual void HandleAutoKey(EventRecord *theEvent);
  92.     virtual void HandleKeyDown(EventRecord *theEvent);                    
  93.  
  94.     virtual void HandleDiskEvt(EventRecord *theEvent);
  95.  
  96.     virtual void HandleHighLevelEvent(EventRecord *theEvent);
  97.     virtual void HandleOSEvent(EventRecord *theEvent);
  98.     virtual void HandleUpdateEvt(EventRecord *theEvent);
  99.     
  100.     virtual void HandleMouseDown(EventRecord *theEvent, 
  101.                             short thePart, WindowPtr theWindow);
  102.  
  103.  
  104. //
  105. // The following are the default MENU handling methods
  106. //        
  107.     virtual void HandleMenuChoice(short menuID, short menuItem);
  108.             // called by application or other eventHandler object
  109.             
  110.     void EnableMenuItem(MenuHandle menu, short item, Boolean enable);
  111.     
  112.     virtual void SetUpMenues(void);
  113.             // sets up menues in responce to a MouseDown event.
  114.             // it passes on this measeage to the entier chain of
  115.             // eventHandlers
  116.  
  117. }; // end of Class declaration
  118.  
  119. #endif __DEVENTHANDLER__
  120.  
  121.